import java.util.Scanner;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 86135
 * Date: 2023-04-18
 * Time: 20:04
 */
public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine(); // 输入一个字符串
        int segmentCount = 0;
        for (int i = 0; i < str.length(); i++) {
            if ((i == 0 || str.charAt(i - 1) == ' ') && str.charAt(i) != ' ') {
                segmentCount++;
            }
        }
        System.out.println(segmentCount);
    }
}
